#include <iostream>
#include <string>

using namespace std;

template <typename T>
class Foo{
public:
	static size_t count() {return ctr ++;}

private:
	static size_t ctr;
};

template<typename T>
size_t Foo<T>::ctr = 0;
/*
size_t Foo<int>::ctr = 0;
size_t Foo<string>::ctr = 110;
*/

int main(){
	Foo<int> fi1, fi2, fi3;
	Foo<string> fs1, fs2;
	Foo<char> fc;
				 // without previous initialization will cause:
	fi1.count(); // Error LNK2001: unresolved external symbol "private: static unsigned int Foo<int>::ctr" (?ctr@?$Foo@H@@0IA)
	fi1.count();
	fs1.count(); // Erro LNK2001: unresolved external symbol "private: static unsigned int Foo<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::ctr" (?ctr@?$Foo@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@0IA)

	return 0;
}